
//
//  HMEmoticonPopButton.swift
//  weibo
//
//  Created by JonsonLiu on 16/4/29.
//  Copyright © 2016年 liujonson. All rights reserved.
//

import UIKit

class HMEmoticonPopButton: UIButton {

    var emtcion : HTEmoticon? {
    
        didSet{
            
            if emtcion?.type == "1" {
            
                self.setTitle((emtcion!.code! as NSString).emoji(), forState: .Normal)
            }else{
                
               let image =  UIImage(named: "\(emtcion?.folderName ?? "")/\(emtcion?.png ?? "")", inBundle: HTEmoticonKeyBoardViewModel.sharedViewModel.emotionBundle, compatibleWithTraitCollection: nil)
                
                self.setImage(image, forState: .Normal)
                self.setTitle(nil, forState: .Normal)
            }
            
        }
    }
}
